//
// Created by zhou on 2021/10/19.
//

#include <iostream>
#include <vector>
using namespace std;
class Solution{
public:
    void moveZeros(vector<int>&nums){
        int size=nums.size();
        int slow=0,fast=0;
        for(int i=0;i<size;i++){
            if(nums[fast]==0&&fast<size) {
                fast++;
            }
            if(nums[fast]!=0){
                nums[slow]=nums[fast];
                fast++;
                slow++;
            }
        }

        for(int i=slow;i<size;i++){
            nums[i]=0;
        }
    }
};

int main(){
    vector<int> nums={0,1,0,3,12};
    Solution solution;
    solution.moveZeros(nums);
    for(int i=0;i<nums.size();i++){
        cout<<nums[i]<<",";
    }
    return 0;
}
